<!--
 * @Descripttion:
 * @version:
 * @Author: cxguo
 * @Date: 2019-08-02 15:03:05
 * @LastEditors: cxguo
 * @LastEditTime: 2020-11-07 13:26:27
 -->
<template>
  <div class="app-container">
    <div class="padding20 border-gay">
      <h2>导入客户资料</h2>
      <div class="margin-t20">
        <el-row :gutter="20">
          <el-col :span="6">
            <el-card shadow="hover">
              <div slot="header" class="clearfix">
                <h3>下载Excle模板</h3>
              </div>
              <el-button
                type="primary"
                plain
                class="wfull"
                @click="btnDownloadTemp"
              >点击下载</el-button>
            </el-card>
          </el-col>
          <el-col :span="6">
            <el-card shadow="hover">
              <div slot="header" class="clearfix">
                <h3>选择Excle模板</h3>
              </div>
              <div>
                <el-button
                  type="primary"
                  plain
                  class="wfull"
                  @click="btnUpLoad"
                >上传导入</el-button>
              </div>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>
<script>

import { oftenuse } from '@/libs/mixins'
import { downloadExcleTemp } from '@/api/bsd/customer/customer.js'
import { exportBlob } from '@/libs/util.js'

export default {
  name: 'SupplierImport',
  mixins: [oftenuse],
  data() {
    return {
    }
  },
  methods: {
    btnDownloadTemp() {
      const loading = this.$loading({ fullscreen: true, text: '下载中' })
      downloadExcleTemp().then(res => {
        loading.close()
        let fileName = res.headers['content-disposition'].split('filename=')[1]
        fileName = decodeURI(fileName)
        const data = res.data
        exportBlob(data, fileName)
      }).catch(_ => {
        loading.close()
      })
    },
    btnUpLoad() {

    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss">
</style>
